import { eventLog } from '../util/event-log'
import common from '../store/common'

const useSubs = (reducer) => {
  const { event$ } = common
  if (event$) {
    event$.useSubscription(({ action, val }) => {
      reducer({ action, val })
      eventLog(action, val)
    })
  }
}

export default useSubs
